<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ include file="/page/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp"%>
<script type="text/javascript">
	var basePageMake = "${ctx}/pagemgr/edit";
	var pageMakeUrl = "", pageId = "";

	function rowClickAfter(rowIndex, appId, userId) {

		/*pageId = curPageId;
		pageMakeUrl = basePageMake + "?page_id=" + pageId;
		 */
		var arrId = document.getElementsByName("check");
		arrId[rowIndex - 1].checked = true;
	}

	//新增
	function doAdRollAdd() {
		window.location.href = "${ctx}/appAdRoll/jumpAddAdRoll?appid=${appid}";
	}
	//修改
	function doAdRollEdit() {
		if (recordKey == null) {
			alert("请选择一条记录！");
		} else {
			window.location.href = "${ctx}/appAdRoll/jumpUpdateAdRoll?appId=${appid}&recordKey="
					+ recordKey;
		}
	}
	//删除
	function doAdRollDelete() {
		if (recordKey == null) {
			alert("请选择一条记录！");
		} else {
			if (confirm("确认删除吗？")) {
				window.location.href = "${ctx}/appAdRoll/deleteAdRoll?appId=${appid}&recordKey="
						+ recordKey;
				window.location.reload();
			}
		}
	}
	//查看
	function doAdRollView() {

		if (recordKey == null) {
			alert("请选择一条记录！");
		} else {
			window.location.href = "${ctx}/appAdRoll/viewAdRoll?appid=${appid}&recordKey="
					+ recordKey;
		}
	}
</script>
</head>
<body>
	<br>
	<div class="op-btn">
		<input type="button" class="btn btn-default" value="新增"
			onclick="doAdRollAdd()" /> <input type="button"
			class="btn btn-default" value="修改" onclick="doAdRollEdit()" /> <input
			type="button" class="btn btn-default" value="删除"
			onclick="doAdRollDelete()" /> <input type="button"
			class="btn btn-default" value="查看" onclick="doAdRollView()" />
	</div>
	<macms:table dataListName="adrList">
		<macms:html id="ch" label="选择" innerHtml="<input type=\"radio\" name=\"check\" value=\"15\">"></macms:html>
		<macms:text id="record_key" label="编号" align="center"></macms:text>
		<macms:text id="ad_file_url" label="广告图片地址" align="center"></macms:text>
		<macms:text id="jump_url" label="广告跳转链接" align="center"></macms:text>
		<macms:text id="ad_roll_length" label="广告轮播数量" align="center"></macms:text>
		<macms:text id="ad_roll_int" label="广告轮播间隔" align="center"></macms:text>
		<macms:text id="ad_desc" label="广告说明" align="center"></macms:text>
	</macms:table>
	<script type="text/javascript">
		var preRow = null;
		var recordKey;
		$('tbody tr').bind('click', function() {
			var rowIndex = $(this).prevAll().length + 1;
			if (rowIndex < 1) {
				return;
			}
			if (preRow != null) {
				preRow.removeClass("active");
			}
			$(this).addClass("active");
			preRow = $(this);
			recordKey = $(this).find("td").eq(1).text();
			// 行单击后事件(传入行号，页面标识)
			rowClickAfter(rowIndex, $(this).find("td").eq(1).text());
		});
	</script>
</body>
</html>
